package Vis;

import java.util.Collection;
import java.util.Hashtable;

import javax.swing.BoxLayout;
import javax.swing.JPanel;

public class Users extends JPanel{

	private static final long serialVersionUID = 1L;
	Hashtable<Integer, User> users = null;
	
	public Users(){
		users = new Hashtable<Integer,User>();
		
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	}
	
	public int userCount(){
		return users.size();
	}
	

	public User getUser(int i){
		return users.get(i);
	}
	
	public void addUserWithID(int i){
		users.put(new Integer(i), new User(i));
		this.add(users.get(i));
		this.validate();
	}
	
	public void removeUserWithID(int i){
		
		this.remove(users.get(i));
		users.remove(i);
		
		this.validate();
	}
	
	public Collection<User> getUsers(){
		return users.values();
	}
	
	public Collection<Integer> getUserIDs(){
		return users.keySet();
	}
	
	public boolean isEmpty(){
		return users.isEmpty();
	}
	
}
